<link rel="stylesheet" href="/assets/home/css/poster.css">
<!-- 请求 -->
<script src="/assets/home/plugin/axios/axios.min.js"></script>
<script src="/assets/home/plugin/axios/request.js"></script>

<div class="poster">
    <img id="img" src="{$Business['poster_text']}" alt="">
</div>

<div class="link">
    <input type="text" readonly="" id="url" value="{$url}">
    <button class="mui-btn mui-btn-primary" type="button" id="btn">点击复制</button>
</div>

<div class="update">
    <button class="mui-btn mui-btn-success" type="button" id="update">重新生成海报</button>
</div>

<!-- 引入底部 -->
{include file='common/footer' /}

<script>

    // 点击复制
    $("#btn").click(function () {
        let url = document.getElementById("url");

        url.select();

        //让浏览器来执行copy命令
        document.execCommand('Copy') && mui.toast('已复制到剪切板')
    })

    // 生成海报
    $("#update").click(async function () {
        let result = await POST({ url: `{:url('home/team/poster')}` });
        if (result.code == 1) {
            setTimeout(() => { 
                location.reload(); 
            }, 500);
        }
    })

</script>